package com.booking.springrestful.controller;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.booking.springrestful.domain.Appointments;
import com.booking.springrestful.domain.Feedback;
import com.booking.springrestful.domain.PatternUploadReview;
import com.booking.springrestful.domain.Users;
import com.booking.springrestful.domain.dto.PatternReviewDto;
import com.booking.springrestful.domain.dto.PatternReviewSubmitDto;
import com.booking.springrestful.domain.vo.PatternReviewVo;
import com.booking.springrestful.mapper.AppointmentsMapper;
import com.booking.springrestful.mapper.FeedbackMapper;
import com.booking.springrestful.mapper.UsersMapper;
import com.booking.springrestful.resp.PageResult;
import com.booking.springrestful.resp.ResponseResult;
import com.booking.springrestful.service.PatternUploadReviewService;
import com.booking.springrestful.utills.StatusEnum;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;
import java.util.concurrent.atomic.AtomicReference;
import java.util.stream.Collectors;

@RestController
@Slf4j
@RequestMapping("/pattern_upload_review")
public class uploadReviewController {

    @Resource
    private UsersMapper usersMapper;

    @Resource
    private PatternUploadReviewService uploadReviewService;

    // 咨询师检查是否有预约
    @PostMapping("/uploadPattern")
    private ResponseResult uploadPattern(@RequestBody PatternUploadReview uploadReview){

        uploadReviewService.uploadPattern(uploadReview);

        return ResponseResult.success("上传成功");
    }

    // 分页查询
    @PostMapping("/list")
    public ResponseResult<PageResult<PatternReviewVo>> getReviewList(@RequestBody PatternReviewDto dto) {
        Page<PatternReviewVo> page = new Page<>(dto.getCurrent(), dto.getPageSize());
        PageResult<PatternReviewVo> result = uploadReviewService.getReviewList(page, dto);
        return ResponseResult.success(result);
    }

    // 提交审核
    @PostMapping("/submit")
    public ResponseResult<String> submitReview(@RequestBody PatternReviewSubmitDto submitDto) {
        uploadReviewService.submitReview(submitDto);
        return ResponseResult.success("审核提交成功");
    }




}
